package com.jjc.android.adapter

import android.widget.ImageView
import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.jjc.android.R
import com.jjc.android.entity.MediaInfo

class FeedbackImageAdapter(data:List<MediaInfo>) : BaseQuickAdapter<MediaInfo,BaseViewHolder>(R.layout.item_feedback_image,data) {

    override fun convert(helper: BaseViewHolder, item: MediaInfo) {
        if(item.isAddImageType){
            helper.setVisible(R.id.contentImage,false)
            helper.setVisible(R.id.deleteBtn,false)
            helper.setVisible(R.id.addImageBtn,true)
            helper.addOnClickListener(R.id.addImageBtn)
        }else{
            helper.setVisible(R.id.contentImage,true)
            helper.setVisible(R.id.deleteBtn,true)
            helper.setVisible(R.id.addImageBtn,false)
            val contentImage:ImageView = helper.getView(R.id.contentImage);
            Glide.with(contentImage).load(item.mediaPath).into(contentImage)
            helper.addOnClickListener(R.id.deleteBtn)
        }
    }

}